﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>菜单权限日志记录</title>
	<meta charset="utf-8" />
    <!--<link href="/MESShopfloor/styles/MESShopfloor.css" type="text/css" rel="Stylesheet" />-->
    <script type="text/javascript" src="/MESShopfloor/Scripts/DateControl.js"></script>
    <script type="text/javascript" src="/MESShopfloor/Scripts/json2.js"></script>

    <script src="/MESShopfloor/Content/Easyui/jquery.min.js" type="text/javascript"></script>
    <script src="/MESShopfloor/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="/MESShopfloor/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <link href="/MESShopfloor/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/MESShopfloor/Content/Easyui/themes/icon.css" rel="stylesheet" />

    <link href="/MESShopfloor/Content/Easyui/custom-easyui.css" rel="stylesheet" /><!--定制化easyui样式-->

    <style>
      
    </style>
</head>
<body>
    <div>
        <table class="SearchSectionTable" cellpadding="5" cellspacing="0" width="100%">
            <tr>
                <td align="left" class="tdRight" width="120px">
                    <div class="divLabel" style="margin-bottom:5px">开始日期：</div>
                    <input id="txtStartDate"  onclick="this.value = ''; setday(this);" class="dateTextBox" type="text" style="height:30px"/>
                </td>
                <td align="left" class="tdRight" width="120px">
                    <div class="divLabel" style="margin-bottom:5px">结束日期：</div>
                    <input id="txtEndDate" onclick="this.value = ''; setday(this);" class="dateTextBox" type="text" style="height:30px"/>
                </td>
                <td class="tdNoBorder" nowrap="nowrap" valign="bottom">
                    <a href="#" id="btnSearch" class="easyui-linkbutton" data-options="" onclick="searchData('gdRecordInfo', 1, 10)" style="">查询</a>
                    <a href="#" id="btnSearch" class="easyui-linkbutton" data-options="" onclick="resetData()" style="">重置</a>
                </td>
            </tr>
        </table>
    </div>
    <div style="background:#fff">
        <div class="" style="margin-top:5px;width:1000px">
            <table id="gdRecordInfo" class="easyui-datagrid" style="width:100%;height:400px"
                   data-options="rownumbers:true,singleSelect:true,striped:true,checkOnSelect:true,selectOnCheck:true,pagination:false,pageNumber:1,pageSize:5,pageList:[5,10,20]">
                <thead>
                    <tr>
                        <th data-options="field:'ck',checkbox:true,hidden:true"></th>
                        <th data-options="field:'FULLNAME',width:120">操作人</th>
                        <th data-options="field:'CREATEDATE',width:150 ">操作时间</th>
                        <th data-options="field:'OPERATIONTYPE',width:120">操作类型</th>
                        <th data-options="field:'BUSINESSNAME',width:80,hidden:true">功能模块</th>
                        <th data-options="field:'DESCRIPTION',width:300">操作描述</th>
                        <th data-options="field:'ID',width:80,hidden:true">id</th>
                        <th data-options="field:'PARENTID',width:80,hidden:true">PARENTID</th>
                        <th data-options="field:'PARENTNAME',width:80,hidden:true">PARENTNAME</th>
                    </tr>
                </thead>
            </table>
            <div id="pp" style="float:right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo',
                            handler:function(){
                               var pageNumber=$('#pageGo').parents('tr').find('.pagination-num').val();
                                searchData('gdRecordInfo',pageNumber,10);
                            }
                    }]  
                "></div>
        </div>

        <div style="clear:both"></div>
    </div>
    

    <script type="text/javascript">
        var w = window, website = "MESShopfloor";
        var pageInfo = {};
        function ShowMessage(msg, istrue) {
            try {
                top.ShowMessage(msg, istrue);
            } catch (err) {

            }
        }

        //定制化分页
        function customizedPage(id) {
            ShowMessage('',true);
            var p = $("#" + id);
            //p.find('table tbody tr td a>span').removeClass('l-btn-icon-left');
            //p.find('table tbody tr td a>span span:first-child').removeClass('l-btn-empty');
            p.find('table tbody tr td a .l-btn-left .l-btn-text:eq(0)').html('首页');
            p.find('table tbody tr td a .l-btn-left .l-btn-text:eq(1)').html('上一页');
            p.find('table tbody tr td a .l-btn-left .l-btn-text:eq(2)').html('下一页');
            p.find('table tbody tr td a .l-btn-left .l-btn-text:eq(3)').html('尾页');
            p.find(".l-btn-icon").text('');
        }

        function searchData(gridID, pageNumber, pageSize) {
            
            gridID = "#" + gridID;
           
            var param = {};
            param.CurrentPageIndex = pageNumber;
            param.PageSize = pageSize;
            param.action = "GetPermissionMenuRecord";
            param.StartDate = $("#txtStartDate").val();
            param.EndDate = $("#txtEndDate").val();
            param.BusinessNames = "'系统配置','基础数据'";
         
            $.ajax({
                type: "Post",
                url: "/MESShopfloor/Ashx/BwSystemManager.ashx",
                // contentType: "application/json",
                //dataType: "json",
                data: param,
                cashe: false,
                beforeSend: function () {
                    //$(gridID).datagrid('loading');
                },
                success: function (data) {
                    //$.messager.progress('close');
                    $(gridID).datagrid('loaded');
                    var result = JSON.parse(data);

                    //给分页对象赋值
                    pageInfo.total = result.RowCount; pageInfo.pageSize = pageSize; pageInfo.pageNumber = pageNumber;

                    $(gridID).datagrid('loadData', { total: result.RowCount, rows: result.DBTable });
                   
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.responseText);
                }

            });
                       
        }

        $("#gdRecordInfo").datagrid({
            onLoadSuccess: function (data) {
                $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                    total: pageInfo.total,
                    pageSize: pageInfo.pageSize,
                    pageNumber: pageInfo.pageNumber
                });
                customizedPage('pp');//定制化分页
            }
        });

        $('#pp').pagination({
            onSelectPage: function (pageNumber, pageSize) {
                customizedPage('pp');//定制化分页
                searchData('gdRecordInfo', pageNumber, pageSize);
               
            }
        });

        //重置
        function resetData() {
            $("#txtStartDate").val(''); $("#txtEndDate").val('');
            $("#gdRecordInfo").datagrid('loadData', { total: 0, rows: {} });
            $('#pp').pagination('refresh', { total: 0, pageSize: 0, pageNumber: 0 });
            customizedPage('pp');//定制化分页
            top.ShowMessage('', true);
        }
        
        $(function () {
            var style = 'gridHeaderTh';  // 要改成什么样式
            $(".datagrid-header-row td").each(function (i, th) {
                $(th).addClass(style);
            });
            customizedPage("pp");

        });
       
    </script>
</body>
</html>
